import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { GermplasmIntroVO, GermplasmIntroForm, GermplasmIntroQuery } from '@/api/agriculture/germplasmIntro/types';

/**
 * 查询种质介绍列表
 * @param query
 * @returns {*}
 */

export const listGermplasmIntro = (query?: GermplasmIntroQuery): AxiosPromise<GermplasmIntroVO[]> => {
  return request({
    url: '/agriculture/germplasmIntro/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询种质介绍详细
 * @param introId
 */
export const getGermplasmIntro = (introId: string | number): AxiosPromise<GermplasmIntroVO> => {
  return request({
    url: '/agriculture/germplasmIntro/' + introId,
    method: 'get'
  });
};

/**
 * 新增种质介绍
 * @param data
 */
export const addGermplasmIntro = (data: GermplasmIntroForm) => {
  return request({
    url: '/agriculture/germplasmIntro',
    method: 'post',
    data: data
  });
};

/**
 * 修改种质介绍
 * @param data
 */
export const updateGermplasmIntro = (data: GermplasmIntroForm) => {
  return request({
    url: '/agriculture/germplasmIntro',
    method: 'put',
    data: data
  });
};

/**
 * 删除种质介绍
 * @param introId
 */
export const delGermplasmIntro = (introId: string | number | Array<string | number>) => {
  return request({
    url: '/agriculture/germplasmIntro/' + introId,
    method: 'delete'
  });
};
